import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

public class SuccessHandler implements LoginHandler {
    @Override
    public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String username=request.getParameter("username");
        String password=request.getParameter("password");
        if("admin".equals(username)&&"123".equals(password)){
            HttpSession session = request.getSession();
            session.setAttribute("username", username);
            response.sendRedirect("Successful.jsp");
        }
    }
}
